package com.example.student.controller;
import com.example.student.*;
import com.example.student.pojo.Admin;
import com.example.student.pojo.PageBean;
import com.example.student.pojo.Result;
import com.example.student.service.LoginService;
import com.example.student.service.ScoreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController

public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    public Result login(@RequestParam String username, @RequestParam String password) {
        Admin admin = loginService.login(username, password);
        if (admin != null) {
            return Result.success();
        }
        else return Result.error("用户名或密码错误");
    }


}